home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / mail / delivery / sendmail.002 / sendmail / sendmail-8.7.3-bin / install_sendmail < prev    next >
Encoding:
Text File  |  1995-12-14  |  5.4 KB  |  191 lines

  1. #!/bin/sh
  2. #
  3. #
  4. PATH=$PATH:/usr/sbin:/usr/bin:/bin:/usr/local/bin
  5. umask 022
  6. HOST=`uname -n`
  7. export PATH
  8. USER=${USER:-$LOGNAME}
  9.  
  10. if [ "$1" != "-install" ]; then
  11. (cat <<EOF
  12.  
  13.             Binary distribution of Sendmail 8.7.3 for Linux
  14.         ===============================================
  15.         
  16.         
  17.     Edit this file first to insure the binaries are installed where
  18.     you want them.
  19.  
  20.     *** NO GUARANTEE IS MADE THAT THIS WON'T OVERRIDE EXISTING PROGRAMS
  21.     - PLEASE DON'T JUST RUN THIS UNTIL YOU ARE SURE IT DOES WHAT YOU
  22.       WANT.***
  23.       
  24.     NOTE: the sendmail binary expects to find it's sendmail.cf
  25.     file in the  /etc/ directory - all other file positions are
  26.     defined inside sendmail.cf
  27.  
  28.     This will install files with the following file permissions:
  29.  
  30. -rwsr-x--x   1 root     root       267268 /usr/sbin/sendmail
  31. -rwx--x--x   1 root     root        50180 /usr/sbin/makemap
  32. -rwxr-x--x   1 root     root        17335 /usr/sbin/mailstats
  33. -rwx------   1 root     root        17124 /etc/sendmail.cf
  34. -rwxr-xr-x   1 root     root        72044 /usr/local/etc/smrsh
  35.  
  36. Also, sendmail will be linked to the following:
  37.  
  38. lrwxrwxrwx   1 root     root /usr/sbin/newaliases -> sendmail
  39. lrwxrwxrwx   1 root     root /usr/sbin/mailq -> sendmail
  40.  
  41. The following packages are also installed. If you don't want some
  42. parts of it, either edit this file, or delete them afterwards.
  43.  
  44. -rwsr-xr-x   1 root     root       25907 /bin/mail.local
  45. -rwxr-xr-x   1 root     root       29700 /usr/local/bin/formail
  46. -rwxr-sr-x   1 root     mail       13316 /usr/local/bin/lockfile
  47. -rwsr-sr-x   1 root     mail       54276 /usr/local/bin/procmail
  48.  
  49. Also man pages are installed under /usr/local/man.
  50.  
  51. The following files/directories are also required - as their position depends 
  52. on how you define them in the sendmail.cf file, these positions are just a
  53. suggestion, you will have to install them yourself.
  54.  
  55. -rwx------   1 root     root         3152 Oct 22 04:03 /usr/lib/sendmail.hf
  56. -rw-r--r--   1 root     root          534 Jan 30 14:31 /etc/aliases
  57.  
  58. And the directories:
  59.  
  60. drwx------   2 root     mail         1024 Feb 26 14:38 /var/spool/mqueue/
  61. drwx-wx--x   2 root     mail         1024 Feb 26 14:44 /var/spool/mail/
  62.  
  63. Note: This works for me using procmail (setuid root, setgid mail) as my
  64. local delivery agent. As you can see, this is a very strong directory
  65. protection. If it doesn't work for your local delivery agent (perhaps
  66. mail.local), try opening it up a little at a time until it does - some say
  67. mail spools should be set "1777" - that's world-writable but "sticky" (like
  68. /tmp). I don't know why, but I don't like that idea ;-) All I know is the
  69. above arrangement works 100% for me.
  70.  
  71. After completing the installation, you will need to decide how you 
  72. want sendmail to run - either as a daemon (started at boot-time) or via
  73. inetd.
  74.  
  75.     Type "$0 -install" to actually do the installation.
  76.  
  77. EOF
  78. )|more
  79. else
  80.  
  81. if [ "$USER" != "root" ]; then
  82.     cat<<EOF
  83.     Sorry, installation must be done by root
  84. EOF
  85.     exit
  86. fi
  87.  
  88. if [ ! -f "./${HOST}.cf"  ]; then
  89.     cat<<EOF
  90.  
  91.     You will need to read the documentation and create a sendmail
  92.     configuration file called "./${HOST}.cf" in this directory before 
  93.     running this script.
  94.  
  95. EOF
  96. exit
  97. fi
  98.  
  99. echo ""
  100. echo -n "Actually begin installation now? (Y/[N]): "
  101. read ans
  102. if [ "$ans" = "" -o "$ans" = "N" -o "$ans" = "n" ]; then
  103.   echo "OK, exiting without installing..."
  104.   exit
  105. fi
  106.  
  107. mkdir /usr/sbin /usr/local /usr/local/etc /usr/local/bin /usr/adm/sm.bin > /dev/null 2>&1 || true
  108.  
  109. cd bin
  110.  
  111. cp sendmail /usr/sbin/sendmail
  112. chown root.root /usr/sbin/sendmail
  113. chmod 4711 /usr/sbin/sendmail
  114. rm -f /usr/sbin/mailq /usr/sbin/newaliases
  115. ln -s /usr/sbin/sendmail /usr/sbin/mailq 
  116. ln -s /usr/sbin/sendmail /usr/sbin/newaliases
  117. cp ../${HOST}.cf /etc/sendmail.cf
  118. chmod 700 /etc/sendmail.cf
  119. cp makemap /usr/sbin/makemap
  120. chmod 0755 /usr/sbin/makemap
  121. cp mailstats /usr/sbin/mailstats
  122. chmod 711 /usr/sbin/mailstats
  123. cp smrsh /usr/local/etc/smrsh
  124. chmod 111 /usr/local/etc/smrsh
  125.  
  126. echo "installed sendmail..."
  127.  
  128. type procmail > /dev/null 2>&1
  129. status=$?
  130. if [  "$status" != "0" ]; then
  131.   cp procmail formail lockfile /usr/local/bin/
  132.   chown root.mail /usr/local/bin/procmail /usr/local/bin/formail /usr/local/bin/lockfile
  133.   chmod 6755 /usr/local/bin/procmail
  134.   chmod 2755 /usr/local/bin/lockfile
  135.   echo "installed procmail/lockfile/formail in /usr/local/bin/ ..."
  136. fi
  137.  
  138.  
  139. type mail.local > /dev/null 2>&1
  140. status=$?
  141. if [  "$status" != "0" ]; then
  142.   cp mail.local /bin/mail.local
  143.   chown root.mail /bin/mail.local
  144.   chmod 4751 /bin/mail.local
  145.   echo "installed /bin/mail.local ..."
  146. fi
  147.  
  148. cd ..
  149.  
  150. touch /etc/sendmail.st
  151. if [ ! -r /var/spool/mail ]; then
  152.   mkdir /var/spool/mail
  153.   chown root.mail /var/spool/mail
  154.   chmod 0711 /var/spool/mail
  155.   echo "created /var/spool/mail directory ..."
  156. fi
  157.  
  158. if [ ! -r /var/spool/mqueue ]; then
  159.   mkdir /var/spool/mqueue
  160.   chown root.mail  /var/spool/mqueue
  161.   chmod 0700 /var/spool/mqueue
  162.   echo "created /var/spool/mqueue directory ..."
  163. fi
  164.  
  165. cp sendmail.hf /usr/lib/sendmail.hf
  166. echo "installed /usr/lib/sendail.hf..."
  167.  
  168. if [ ! -r /etc/aliases ]; then
  169.     cp aliases /etc/aliases
  170.     echo "installed generic /etc/aliases..."
  171. fi
  172.  
  173. cd man
  174. mkdir /usr/local/man /usr/local/man/man1 /usr/local/man/man5 /usr/local/man/man8 > /dev/null 2>&1 || true
  175.  
  176. umask 033
  177. cp *.8 /usr/local/man/man8/
  178. cp *.5 /usr/local/man/man5/
  179. cp *.1 /usr/local/man/man1/
  180. echo "installed man pages."
  181. fi
  182.  
  183. cat<<EOF
  184.  
  185. Installation complete.
  186.  
  187. You will now need to set up your system so that sendmail runs as a daemon 
  188. (either via inetd or at boot-time)
  189.  
  190. EOF
  191.